import requests

# 下载并保存二进制文件
res = requests.get('https://www.bilibili.com/favicon.ico')
with open('../favicon.ico', 'wb') as f:
    f.write(res.content)

# 上传文件
files = {'file': open('../favicon.ico', 'rb')}
res = requests.post('https://www.bilibili.com/favicon.ico', files=files)
print(res.text)